import SwiftUI
import SwiftData

// ContentView
// 顶层界面分发

struct ContentView: View {
    @Environment(\.modelContext) private var modelContext
    @Query private var loginInfo: [LoginInfo]

    var body: some View {
        if(loginInfo.isEmpty) {
            LoginPage()
                .modelContext(modelContext)
        } else {
            TabPageContainer()
                .modelContext(modelContext)
        }
    }
}

#Preview {
    ContentView()
        .modelContainer(for: [
            LoginInfo.self,
            UserInfo.self
        ])
}
